<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>

    <meta charset="UTF-8">
    <title>订单管理</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">


</head>
<body>
<div th:insert="~{public/publicTop::admintop}"></div>

<form method="post" >
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>订单管理</legend>
    </fieldset>
    <div class="layui-bg-gray" style="padding: 30px;" >
        <div class="layui-row layui-col-space15 " style=" width: 70%; margin: auto">

            <a th:each="order:${orders}" class="layui-col-md12" style="height: 100%">
                <div class="layui-col-md6">
                    订单id:<p th:text="${order.getId()}"></p>
                    订单时间:<p th:text="${order.getDateTime()}"></p>
                    订单状态:
                    <a th:switch="${order.getState()}"  >
                        <div th:case="${0}">
                            <a >未发货</a>
                            <a class="layui-btn"  th:text="发货" th:value="发货" th:href="@{'/admin/send/'+${order.getId()}+'/'+${ye}}"> </a>
                        </div>
                        <div th:case="${1}">
                            <a >已发货</a>
                            <a class="glyphicon glyphicon-send	" ></a>
                        </div>
                        <div th:case="${2}">
                            <a >已确认收货</a>
                            <a class="glyphicon glyphicon-ok "  ></a>
                        </div>

                    </a>
                    <br>

                </div>
                <div class="layui-col-md6">
                    地址：
                    <p th:text="${order.getName()}"></p>
                    <p th:text="${order.getPhone()}"></p>
                    <p th:text="${order.getAddress()}"></p>
                </div>
                <div >

                    <div class="layui-card" style="margin: auto; text-align: center">
                        <div style="padding: 50px 30px;">
                            <table class="layui-table" >
                                <thead>
                                <tr>
                                    <th>商品名称</th>
                                    <th></th>
                                    <th>商品颜色</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:each="good:${order.getOrderGoodes()}">
                                    <td th:text="${good.getGoodName()}"></td>
                                    <td><img th:src="@{'/img/'+${good.getGoodImg()}}"></td>
                                    <td th:text="${good.getColor()=='null'?'无':good.getColor()}"></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <hr class="layui-border-red">

            </a>
            <div style="margin: auto;text-align: center;">
                <ul class="pagination" style="margin: auto;text-align: center;">
                    <li><a th:href="@{'/admin/order/'+${ ye - 1>0? ye - 1:1 }}" >&laquo;</a></li>
                    <li th:each="index:${#numbers.sequence(1,sum)}" th:class="${ye==index?'active':null}">
                        <a  th:text="${index}" th:value="${index}" th:href="@{'/admin/order/'+${index}}" ></a>
                    </li>
                    <li><a th:href="@{'/admin/order/'+${ ye + 1<sum? ye + 1:sum }}">&raquo;</a></li>
                </ul>
            </div>
        </div>

    </div>



</form>

</body>
<script src="https://www.layuicdn.com/layui-v2.5.6/layui.js"></script>
<script >
    layui.use('form', function(){
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
        form.render();
    });

    function selectALl(a){
        var s=document.getElementsByName("shangPin");
        console.log(s);
        for (var sElement of s) {
            sElement.checked=a.checked;
        }
    }
</script>
</html>